home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / overview / dtscpluslibrary / headers / window.h < prev   
Encoding:
Text File  |  2000-09-28  |  3.0 KB  |  95 lines

  1. /*
  2.     File:        Window.h
  3.  
  4.     Contains:    TWindow is a Window wrapper class that handles most of the basic window functionality.
  5.                   Window.h contains the TWindow class definition.
  6.     Written by:     
  7.  
  8.     Copyright:    Copyright © 1992-1999 by Apple Computer, Inc., All Rights Reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.                 8/18/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  20.                 
  21.  
  22. */
  23. // Declare label for this header file
  24. #ifndef _WINDOW_
  25. #define _WINDOW_
  26.  
  27. #ifndef _DTSCPLUSLIBRARY_
  28. #include "DTSCPlusLibrary.h"
  29. #endif
  30.  
  31. #ifndef __WINDOWS__
  32. #include <Windows.h>
  33. #endif
  34.  
  35. #ifndef _ENVIRONMENT_
  36. #include "Environment.h"
  37. #endif
  38.  
  39.  
  40. // _________________________________________________________________________________________________________ //
  41. //    TWindow Class Interface.
  42. class TWindow
  43. // TWindow is a simple Window class that could be used to produce simple window objects.
  44. {
  45. public:
  46.     // TYPEDEFS AND ENUMS
  47.     enum ECoordinates                            // used to define the default window size/position
  48.     {
  49.         kTop = 50, kLeft = 50, kBottom = 275, kRight = 275
  50.     };
  51.  
  52.     // CONSTRUCTORS AND DESTRUCTORS
  53.     TWindow();                                    // default constructor
  54.     TWindow(short windowID);                    // create a window based on a resource ID
  55.     virtual~ TWindow();                            // default destructor
  56.  
  57.     virtual void Initialize();                    // initialize fields to known values
  58.  
  59.     // MAIN INTERFACE
  60.     virtual void Draw();                        // the main drawing routine
  61.     virtual void DoClick();                        // handle mouse clicks inside window
  62.     virtual void Show();                        // show window
  63.     virtual void Hide();                        // hide window
  64.  
  65.     // GET/SET FUNCTIONS
  66.     virtual WindowPtr GetWindowPtr() const;        // get the object's WindowPtr
  67.     virtual void SetTitle(const Str255* title);    // set window title
  68.     virtual void GetTitle(Str255* result) const;// get window title
  69.     virtual Rect GetExtent() const;                // get window interior rect
  70.     virtual Rect GetFrame() const;                // get window frame rect
  71.     virtual Boolean Contains(Point test) const;    // test if point is inside window
  72.     virtual Boolean IsColorWindow() const;        // color window or not?
  73.  
  74.     // FIELDS
  75. protected:
  76.     WindowPtr fWindow;                            // our single WindowPtr
  77.     WindowPeek fWindowRecord;                    // pointer to the window record
  78.     Str255 fWindowTitle;                        // out window title
  79.     Rect fRect;                                    // the rect for the window
  80.     Boolean fColorWindow;                        // enabled if the window supports Color QD
  81. };
  82.  
  83.  
  84. #endif
  85.  
  86. // _________________________________________________________________________________________________________ //
  87.  
  88.  
  89. /*    Change History (most recent last):
  90.   No        Init.    Date        Comment
  91.   1            khs        11/7/92        New file
  92.   2            khs        1/7/93        Cleanup
  93. */
  94.  
  95.